package com.fuqi.android.zhongcai.utils;

import com.fuqi.android.zhongcai.application.UniApplication;
import com.fuqi.android.zhongcai.base.model.Provinces;
import com.fuqi.framework.gson.GsonHelper;
import com.google.gson.Gson;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by Lenovo on 2016/9/28.
 */
public class ProvinceUtils {


    public static void handleProvinceJSON() {

        Provinces provinces;
        InputStream is = null;
            try {
                is = UniApplication.getInstance().getAssets().open("province.json");
                String str = IOUtils.toString(is);
                Gson gson = new Gson();
                provinces = gson.fromJson(str, Provinces.class);

                IOUtils.closeQuietly(is);
            } catch (IOException e) {
                throw new RuntimeException(e);
            } finally {
                IOUtils.closeQuietly(is);
            }


        LogUtils.i("provinces: " + GsonHelper.writeValue(provinces));
    }


}
